Skip to content

Generating correct LIMIT and OFFSET field names #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

Generating correct LIMIT and OFFSET field names #204

wants to merge 7 commits into from

Conversation

dominikbraun
Copy link
Contributor

Fixes #201.

A query like this caused incorrect field names for LIMIT and OFFSET:

-- name: GetFoo :one
SELECT
    (SELECT 1) AS baz
FROM foo
WHERE
	bar = $1
LIMIT $2
OFFSET $3;

The generated struct used to look like this:

type GetFooParams struct {
	Bar   string `json:"bar"`
	Bar_2 string `json:"bar_2"`
	Bar_3 string `json:"bar_3"`
}

This happened because LIMIT and OFFSET are nil for the subquery but they've been assigned to the paramSearch though.

@dominikbraun
Copy link
Contributor Author

Oops, looks like my previous commits from #178 were in my local history.

@dominikbraun dominikbraun deleted the issue/201 branch December 19, 2019 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LIMIT, OFFSET don't work when subquery is present
1 participant